package day2;

import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.typeinfo.Types;
import org.apache.flink.api.java.functions.KeySelector;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.util.Collector;
import scala.Tuple2;

public class Test3_Lambda2 {
    public static void main(String[] args) {
        /*StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        DataStreamSource<String> streamSource = env.fromElements("hello,heihei,hello", "word,hello,word", "word,word,hello", "heihei,word,haha", "haha,word,word", "haha,heihei,word");

        streamSource.flatMap((s,collector) -> {
                String[] arr = s.split(",");
                for (String s1 : arr) {
                    collector.collect(s1);
                }
        }).returns(Types.STRING)
                .map((String value) -> Tuple2.of(value,1)).returns(Types.TUPLE(Types.STRING,Types.INT))
                .keyBy(value -> value.f0)
                .sum(1).print();

        env.execute("");*/
    }
}
